@ECHO OFF

:SET_ENVIRONMENT
SETLOCAL
SET HOSTS=%WINDIR%\system32\drivers\etc\hosts
SET   X32=.\Adobe amtlib.dll\32-bit
SET   X64=.\Adobe amtlib.dll\64-bit
IF EXIST %TEMP%\AH*.TXT DEL %TEMP%\AH*.TXT

:BUILD_HOSTS_FILE
REM :ADOBE NAMESERVERS
ECHO 127.0.0.1                   3dns.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1                 3dns-1.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1                 3dns-2.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1                 3dns-3.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1                 3dns-4.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1              adobe-dns.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1            adobe-dns-1.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1            adobe-dns-2.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1            adobe-dns-3.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
ECHO 127.0.0.1            adobe-dns-4.adobe.com  # Adobe nameserver>>          %TEMP%\AH1.TXT
REM :ADOBE ACTIVATION SERVERS IN ADOBE NAMESPACE
ECHO 127.0.0.1                  192.150.8.100    # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                  192.150.8.118    # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                  192.150.14.69    # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                  192.150.18.101   # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                  192.150.18.108   # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                  192.150.22.40    # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1               activate.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1           activate-sea.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1          activate-sjc0.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                   ereg.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                 hl2rcv.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1               licenses.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1       na2m-pr.licenses.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1            lm.licenses.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1             lmlicenses.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1             practivate.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                    wip.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1           activate.wip.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1               ereg.wip.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1         lmlicenses.wip.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                   wip1.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1          activate.wip1.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1              ereg.wip1.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1        lmlicenses.wip1.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                   wip2.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1          activate.wip2.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1              ereg.wip2.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1        lmlicenses.wip2.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                   wip3.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1          activate.wip3.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1              ereg.wip3.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1        lmlicenses.wip3.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                   wip4.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1          activate.wip4.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1              ereg.wip4.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1        lmlicenses.wip4.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1       wwis-dubc1-vip60.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1       wwis-dubc1-vip60.adobe.com  # Adobe activation server>>   %TEMP%\AH1.TXT
REM :ADOBE ACTIVATION SERVERS OUTSIDE OF ADOBE NAMESPACE
ECHO 127.0.0.1               adobe.activate.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                    adobeereg.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1              adobe.tt.omtrdc.net  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                 ood.opsource.net  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1    209-34-83-73.ood.opsource.net  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1      tss-geotrust-crl.thawte.com  # Adobe activation server>>   %TEMP%\AH1.TXT
ECHO 127.0.0.1                 crl.verisign.net  # Adobe activation server>>   %TEMP%\AH1.TXT

:QUEUE
FOR /F "tokens=1,2" %%g IN (%TEMP%\AH1.TXT) DO CALL :PROCESS_HOSTS_1 %%g %%h
IF DEFINED ProgramFiles(x86) GOTO :COPY_FILES_X64
GOTO :COPY_FILES_X32
GOTO :DONE

:PROCESS_HOSTS_1
FIND /I "%2" < %TEMP%\AH1.TXT >%TEMP%\AH2.TXT
FIND /I "%2" < %WINDIR%\system32\drivers\etc\hosts >%TEMP%\AH3.TXT
IF %ERRORLEVEL% NEQ 0 GOTO :ADD_HOSTS
GOTO :PROCESS_HOSTS_2 %1

:PROCESS_HOSTS_2
FIND /I "%1" %TEMP%\AH3.TXT>nul 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO :ADD_HOSTS
GOTO :END

:ADD_HOSTS
TYPE %TEMP%\AH2.TXT>>%WINDIR%\system32\drivers\etc\hosts
GOTO :END

:COPY_FILES_X64
DIR "%ProgramFiles(x86)%\amtlib.dll" /W /S /B >%TEMP%\AH4.TXT
DIR "%ProgramFiles%\amtlib.dll"      /W /S /B >%TEMP%\AH5.TXT
FOR /F "tokens=*" %%g IN (%TEMP%\AH4.TXT) DO COPY /Y "%X32%\amtlib.dll" "%%g">nul 2>&1
FOR /F "tokens=*" %%g IN (%TEMP%\AH5.TXT) DO COPY /Y "%X64%\amtlib.dll" "%%g">nul 2>&1
GOTO :END

:COPY_FILES_X32
DIR "%ProgramFiles%\amtlib.dll" /W /S /B >%TEMP%\AH5.TXT
FOR /F "tokens=*" %%g IN (%TEMP%\AH4.TXT) DO COPY /Y "%X32%\amtlib.dll" "%%g">nul 2>&1
GOTO :END

:DONE
ENDLOCAL
IF EXIST %TEMP%\AH*.TXT DEL %TEMP%\AH*.TXT

:END
REM This script is free to USE & MODIFY for individual use, but not in a
REM 3rd-party contracting situation.  This script is not free for REDISTRIBUTION.
